<header class="header_form">
    <h1>Nouveau relevé</h1>
</header>

<form class="ajax_form" action="./" method="post">
    <input type="hidden" name="todo" value="gestion[newReleve]" />
    <p>
        <label>Produit</label>
        <input type="text" name="u" id="productSF" class="search_field" required />
        <input type="text" style="display:none;" name="product" id="product" value="" class="search_field" required />
    </p>
    <p>
        <label>Magasins</label>
        <select name="magasin">
            { foreach from=$magasins item=magasin }
                <option value="{$magasin._id}">{$magasin.name} - {$magasin.ville.2}</option>
            {/foreach}
        </select>
    </p>
    <p>
        <label>Rayon</label>
        <select name="rayon">
            { foreach from=$rayons item=rayon }
                <option value="{$rayon._id}">{$rayon.name}</option>
            {/foreach}
        </select>
    </p>
    <p>
        <label>Catégorie</label>
        <select name="categorie">
            { foreach from=$categories item=categorie }
                <option value="{$categorie._id}">{$categorie.name}</option>
            {/foreach}
        </select>
    </p>
    <p>
        <label>Marque</label>
        <select name="marque">
            { foreach from=$marques item=marque }
                <option value="{$marque._id}">{$marque.name}</option>
            {/foreach}
        </select>
    </p>
    <p>
        <label>Conditionnement</label>
        <select name="conditionnement">
            { foreach from=$condits item=condit }
                <option value="{$condit._id}">{$condit.name}</option>
            {/foreach}
        </select>
    </p>
    <p>
        <label>Prix</label>
        <input type="text" name="prix" required/>
        <select name="unite">
            <option value="u">/Unité</option>
            <option value="kg">/Kg</option>
            <option value="l">/Litre</option>
            <option value="pk6">/Pack de 6</option>
            <option value="pk12">/Pack de 12</option>
            <option value="pk24">/Pack de 24</option>
        </select>
    </p>
    <p id="bouton">
    	<button type="submit">Valider</button>
    </p>
</form>

{literal}
<style>
    #productSF, .autocomplete {width:150px !important;}
</style>
<script>
    jQuery('#productSF.search_field').autocomplete({
        serviceUrl: '{/literal}{$SYS_FOLDER}{literal}services/autocomplete/product/',
        minChars: 1,
        deferRequestBy: 250,
        onSelect: function(value, data){ jQuery('#product').val(data); }
    });
</script>
{/literal}